<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>

    <div class="component" style="width: 200px; background-color: violet;"> 
      <p>5555</p>
      
      <header>头部</header>
      <header>中部</header>
      <header>尾部</header>
      <p>5555</p>
    </div>
    <div id="app">
      <button-counter></button-counter>
      <button-counter></button-counter>
      <button-counter></button-counter>
      <button-counter></button-counter>
    </div>

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            msg: ""
          }
        }
      });
      app.component('button-counter', {
        data(){
          return {
            count: 0,
          }
        },
        //定义一个全局组件
        template:`
        <button @click="count++">
          点击了{{count}}次
        </button>
        `              
      });

      //挂载
      app.mount('#app');
    </script>
  </body>
</html>